﻿using System;
using System.Linq;
using System.Linq.Expressions;
using WJ.Infrastructure.EntitiesExtension;

namespace WJ.Infrastructure.DDD
{
    public static class QueryExtension
    {
        public static IQueryable<T> WhereByVisible<T>(this IQueryable<T> query,
            Expression<Func<T, bool>> exp)where T:IEntity
        {
            exp = exp.And(t => true);

            return query.Where(exp);
        }

        public static Expression<Func<T, bool>> ByVisible<T>(this Expression<Func<T, bool>> exp) where T : IEntity
        {
            return exp.And(t => true);
        }
    }
}